import type { FilterItem } from '@/components/FilterBar/types'
import { ref } from 'vue'

interface OptionItem {
  label: string
  value: string
}
export const searchStatusOption = ref([
  {
    value: 40,
    label: '待提交'
  },
  {
    value: 41,
    label: '待复核'
  },
  {
    value: 42,
    label: '已驳回'
  },{
    value: 43,
    label: '已通过'
  },
])
export const eventTypeOption = ref<Array<OptionItem>>([])
export const eventLevelOption = ref<Array<OptionItem>>([])
export const commonEventTypeOption = ref<Array<OptionItem>>([])
export const cooperateEventTypeOption = ref<Array<OptionItem>>([])
export const filterOptions = ref<Array<FilterItem>>([
  {
    label: '分类：',
    prop: 'type',
    type: 'select',
    span: 6,
    // relation: 'eventTypeId',
    inputProps: {
      clearable:true,
      options: []
    },
    events: {
      change: (value: any, evt: any) => {
        evt.setFieldsValue({eventTypeId:undefined})
        if(value){
          filterOptions.value[1].isDisabled=false;
          if(value===1){
            filterOptions.value[1].inputProps.options=commonEventTypeOption.value;
          }
          if(value===2){
            filterOptions.value[1].inputProps.options=cooperateEventTypeOption.value;
          }
        }else{
          filterOptions.value[1].isDisabled=true;
        }
      }
    }
  },
  {
    label: '事件类型：',
    prop: 'eventTypeId',
    type: 'select',
    span: 6,
    multiple:true,
    isDisabled: true,
    inputProps: {
      collapseTags: true,
      clearable:true,
      options: []
    },
    events: {
      change: (value: any, evt: any) => {}
    }
  },
  {
    label: '事件级别：',
    prop: 'eventLevel',
    type: 'select',
    span: 6,
    // remark: 'true',
    inputProps: {
      clearable:true,
      options: []
    },
    events: {
      change: (value: any, evt: any) => {}
    }
  },
  {
    label: '区域处置单位：',
    prop: 'process_group_id',
    type: 'treeSelect',
    width: '120px',
    span: 6,
    inputProps: {
      // filterable: true,
      'default-expand-all': true,
      // 'show-checkbox': true,
      'check-strictly': true,
      'node-key':"organizationId",
      clearable:true,
      defaultProps: {
        label: 'organizationName',
      },
      data: [],
    },
    events: {
      change: (value: any, evt: any) => {}
    }
  },
  {
    label: '上报人：',
    prop: 'reportCreatorName',
    type: 'select',
    span: 6,
    inputProps: {
      options: [],
      clearable: true,
      placeholder: '请选择',
      filterable: true,
    },
    events: {
      change: (value: any, evt: any) => {}
    }
  },
  {
    label: '状态：',
    prop: 'status',
    type: 'select',
    span: 6,
    inputProps: {
      clearable:true,
      options: searchStatusOption.value
    },
    events: {
      change: (value: any, evt: any) => {}
    }
  },
  {
    label: '发生时间：',
    prop: 'occurDate',
    type: 'datePicker',
    defaultValue: [],
    span: 10,
    inputProps: {
      type: 'datetimerange',
      format: 'YYYY-MM-DD HH:mm:ss',
      'value-format': 'YYYY-MM-DD HH:mm:ss',
      'start-placeholder': '开始时间',
      'end-placeholder': '结束时间',
      'range-separator': '~',
      defaultTime: [
        new Date(2000, 1, 1, 0, 0, 0),
        new Date(2000, 2, 1, 23, 59, 59),
      ],
    },
    // events:{
    //   change
    // }
  },
  {
    label: '处置完成时间：',
    prop: 'handTime',
    type: 'datePicker',
    width: '120px',
    defaultValue: [],
    span: 10,
    inputProps: {
      type: 'datetimerange',
      format: 'YYYY-MM-DD HH:mm:ss',
      'value-format': 'YYYY-MM-DD HH:mm:ss',
      'start-placeholder': '开始时间',
      'end-placeholder': '结束时间',
      'range-separator': '~',
      defaultTime: [
        new Date(2000, 1, 1, 0, 0, 0),
        new Date(2000, 2, 1, 23, 59, 59),
      ],
    }
  },
  
])
